﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true" CodeBehind="HtmlToolAccountManagement.aspx.cs" Inherits="NetDon.OA.Portal.HtmlTool.HtmlToolAccountManagement" %>
<%@ Register TagPrefix="uc1" TagName="GridPager" Src="~/Controls/GridPager.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" type="text/javascript">
        var userDialogSize = { width: 900, height: 650 };
        function createCustomer() {

            $dialog('<%=ResolveUrl("~/HtmlTool/HtmlToolAccountEdit.aspx") %>?Type=0', userDialogSize, function (result) {
                if (result) {
                    $get('<%=btnReload.ClientID %>').click();
                }
            });
        }

        function modifyCustomer(id) {
            $dialog('<%=ResolveUrl("~/HtmlTool/HtmlToolAccountEdit.aspx") %>?Type=0&Id=' + id, userDialogSize, function (result) {
                if (result) {
                    $get('<%=btnReload.ClientID %>').click();
                }
            });
        }

        function deleteDemand(id) {
            $confirm('确定要删除吗?', function (result) {
                if (result) {
                    $text($get('<%=fieldCustomerId.ClientID %>'), id);
                    $get('<%=btnDeleteDemand.ClientID %>').click();
                }
            });
        }

        function viewOrder(sender, args) {
            var id = $attr(sender.get_selectedRow(), 'Id');

            $dialog('<%= ResolveUrl("~/HtmlTool/HtmlToolAccountEdit.aspx")%>?Type=0&Id=' + id, userDialogSize, function (result) {
                if (result) {
                    $get('<%=btnReload.ClientID %>').click();
                }
            });
        }




    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                <tr>
                    <td valign="bottom">
                        <asp:Button runat="server" ID="btnCreateNew" Text="创建" OnClientClick="createCustomer();return false;" />
                    </td>
                </tr>
            </table>
            <div style="margin-top: 10px">
                <NetDon:GridView ID="gridCustomerInfoList" runat="server" AutoGenerateColumns="False"
                    AllowSorting="true" OnClientRowDblClick="viewOrder"  OnRowDataBound="gridOrderList_RowDataBound" >
                    <Columns>
                        <NetDon:BoundField HeaderText="账号" DataField="Accountname" SortExpression="Accountname">
                        </NetDon:BoundField>
                          <NetDon:BoundField HeaderText="站点" DataField="Sitecode" SortExpression="Sitecode">
                        </NetDon:BoundField>
                          <NetDon:BoundField HeaderText="商品描述来源" DataField="From" SortExpression="From">
                        </NetDon:BoundField>
                            <NetDon:BoundField HeaderText="是否默认" DataField="Isdefault" SortExpression="Isdefault">
                        </NetDon:BoundField>
                        <NetDon:TemplateField HeaderText="操作" ItemStyle-Width="80px">
                            <ItemTemplate>
                                <asp:ImageButton ID="btnEdit" Style="margin-left: 5px" ToolTip="Edit" runat="server"
                                    CommandName="Edit" SkinID="Modify" ImageAlign="AbsMiddle" CausesValidation="false"
                                    OnClientClick='<%# Eval("Id","modifyCustomer(\"{0}\");return false;") %>' />
                                <asp:ImageButton ID="btnDelete" ToolTip="Delete" runat="server" SkinID="Delete" ImageAlign="AbsMiddle"
                                    CausesValidation="false" CommandName="DeleteCustomer" CommandArgument='<%# Eval("Id") %>'
                                    OnClientClick='<%# Eval("Id","deleteDemand(\"{0}\");return false;") %>' />
                            </ItemTemplate>
                        </NetDon:TemplateField>
                    </Columns>
                </NetDon:GridView>
                <asp:Button ID="btnReload" runat="server" SkinID="Hidden" OnClick="btnReload_Click" />
                <asp:HiddenField ID="fieldCustomerId" runat="server" />
                <asp:Button ID="btnDeleteDemand" runat="server" OnClick="btnDeleteDemand_Click" Text="Delete"
                    SkinID="Hidden" />
                        <uc1:GridPager ID="PageQueryAdapter1" runat="server" TargetControlID="gridCustomerInfoList"
                    PageSize="100" OnPerformGetCondition="PageQueryAdapter1_PerformGetCondition" OnPerformGetRecordCount="PageQueryAdapter1_PerformGetRecordCount"
                    OnPerformGetPageData="PageQueryAdapter1_PerformGetPageData" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

